#ifndef WIZARD_H
#define WIZARD_H

#include <QWizard>
#include <QWebView>
#include <QLineEdit>
#include <QNetworkReply>
#include <QLabel>

class Wizard : public QWizard
{
Q_OBJECT
public:
    Wizard(bool firstTime = true, QWidget *parent = 0);
    enum { Page_Intro, Page_Fb, Page_Steam, Page_SaveDir,
           Page_Conclusion,Page_FbError, Page_SteamError };


signals:
    void userHasAuthenticated();
    void userFailedAuthenticaiton();

public slots:

private slots:

private:
    QWizardPage* createIntroPage();
    QWizardPage* createConnectPage();
    QWizardPage* createSteamPage();
    QWizardPage* createFbErrorPage();
    QWizardPage* createSteamErrorPage();
    QWizardPage* createSaveDirPage();
    QWizardPage* createConclusionPage();

    bool m_firstTime;


};

class WebView : public QWebView
{
Q_OBJECT
public:
    explicit WebView(QWidget *parent = 0);

signals:
    void authReceived();
    void authFailed();

private slots:
    void loadFinished();

private:





};

class ConnectPage : public QWizardPage
{
    Q_OBJECT

public:
    explicit ConnectPage(QWidget *parent = 0);
    void initializePage();
    bool isComplete() const;

    // Overrides parent method
    int nextId() const;

signals:

public slots:
    void gotAuth();
    void gotFailed();

private:
    WebView *m_view;
    bool m_isComplete;
    bool m_gotAuth;
    QString m_facebookUrl;

};

class SteamPage : public QWizardPage
{
    Q_OBJECT

public:
    explicit SteamPage(QWidget *parent = 0);
    bool isComplete() const;

    int nextId() const;

private slots:
    void inputEntered(QString input);
    void verifyPressed();
    void steamReply(QNetworkReply *reply);

private:
    bool m_isComplete;
    bool m_steamVerified;
    QLineEdit *m_steamIdInput;
    QPushButton *m_verifyButton;

};

class SaveDirPage : public QWizardPage
{
    Q_OBJECT

public:
    explicit SaveDirPage(QWidget *parent = 0);
    bool isComplete() const;
    int nextId() const;

private slots:
    void choosePressed();

private:
    bool m_isComplete;
    QPushButton *m_chooseButton;
    QString m_path;
    QLabel *m_pathLabel;


};

class ConclusionPage : public QWizardPage
{
    Q_OBJECT

public:
    explicit ConclusionPage(QWidget *parent = 0);
    int nextId() const;

};


class FbErrorPage : public QWizardPage
{
    Q_OBJECT

public:
    explicit FbErrorPage(QWidget *parent = 0);
    bool isComplete() const;


};


class SteamErrorPage : public QWizardPage
{
    Q_OBJECT

public:
    explicit SteamErrorPage(QWidget *parent = 0);
    bool isComplete() const;


};

#endif // WIZARD_H
